<template>
  <div class="log">
    <basic-container>
      <avue-crud
        :page.sync="page"
        :permission="permissionList"
         v-bind="bindVal"
         v-on="onEvent">
        <template slot="menuLeft">
          <el-button type="primary" size="small"
            v-permission="permissionList.delBtn"
            @click="handleDelLog">删除</el-button>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
import baseCrud from '@/mixins/base-crud'
import { delFiledLog } from '@/api/admin/log'

export default {
  name: 'Log',
  mixins: [baseCrud('admin/logFiled')],
  data() {
    return {
      params: {
        descs: 'create_time'
      }
    }
  },
  computed: {
    permissionList() {
      return {
        delBtn: this.vaildData(this.permissions.sys_filed_log_del, false)
      }
    }
  },
  methods: {
    handleDelLog(){
      var tableSelect = this.$refs.crud.tableSelect
      if(tableSelect.length == 0){
        this.$message.info('请选择要删除的记录')
        return
      }
      var ids = tableSelect.map(row => row.id)
      delFiledLog(ids).then(response => {
        this.$message.success('删除成功')
        this.getList(this.page)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
